//! \file system.hpp
//! \brief Purewell Library System Header
//! \author Yubin Lim (purewell@gmail.com)
//! \since 2008-01-25

#ifndef __PWHDR_SYSTEM_HPP__
#define __PWHDR_SYSTEM_HPP__

#include <string>

namespace purewell
{

//! \brief System. (Singleton)
class PWSystem
{
public:
	//! \brief Get current working directory.
	//! \param[out] out Current working directory buffer.
	//! \return Reference of `out'.
	std::string& getCurrentDirectory(std::string& out) const;

	//! \brief Get current working directory.
	//! \param[out] buf Current working directory buffer.
	//! \param[in] blen Buffer length.
	//! \return Reference of `buf'.
	char* getCurrentDirectory(char* buf, size_t blen) const;

	//! \brief Set library log stream.
	//! \param[in] os Output stream pointer.
	//! \return Old output stream pointer.
	std::ostream* setLibraryLogStream(std::ostream* os) const;

	//! \brief Get library log stream.
	//! \return Output stream pointer.
	std::ostream* getLibraryLogStream(void) const;

	//! \brief Get library version.
	//! \param[out] major Major version.
	//! \param[out] minor Minor version.
	//! \param[out] patch Patch version.
	//! \param[out] rel Release version.
	void getLibraryVersion(int* major, int* minor,
		int* patch, int* rel) const;

	//! \brief Get cpu count.
	//! \return CPU count.
	size_t getCPUCount(void) const;

	//! \brief Get online-cpu count.
	//! \return Online-CPU count.
	size_t getOnlineCPUCount(void) const;

public:
	//! \brief Get system instance.
	//! \return Reference of instance.
	static PWSystem& getInstance(void);

private:
	explicit PWSystem();

};

//! \brief System instance.
extern PWSystem& gPWSystem;

};//namespace purewell

#endif//!__PWHDR_SYSTEM_HPP__


